import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '报修号',
    align: "center",
    dataIndex: 'reportCode'
  },
  {
    title: '维修开始日期',
    align: "center",
    dataIndex: 'reportTime'
  },
  {
    title: '维修号',
    align: "center",
    dataIndex: 'repairCode'
  },
  {
    title: '维修完成日期',
    align: "center",
    dataIndex: 'repairTime'
  },
  {
    title: '问题描述',
    align: "center",
    dataIndex: 'problemDesc'
  },
  {
    title: '解决方案',
    align: "center",
    dataIndex: 'solution'
  },
  // {
  //   title: '图片',
  //   align: "center",
  //   dataIndex: 'image',
  //   customRender: render.renderImage,
  // },
  {
    title: ' 描述',
    align: "center",
    dataIndex: 'descibles'
  },
  {
    title: ' 状态',
    align: "center",
    dataIndex: 'state',
    customRender: (text) => {

      let re = ''
      if (text.value === '0') {
        re = '未进行'
      } else if (text.value ==='1') {
        re = '进行中'
      }else if (text.value ==='2') {
        re = '已完成'
      }
      return re
    }
  },
  {
    title: '创建日期',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新日期',
    align: "center",
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "报修号",
    field: 'reportCode',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "维修号",
    field: 'repairCode',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '报修开始日期',
    field: 'reportTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '维修号',
    field: 'repairCode',
    component: 'Input',
  },
  {
    label: '维修完成日期',
    field: 'repairTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '问题描述',
    field: 'problemDesc',
    component: 'Input',
  },
  {
    label: '解决方案',
    field: 'solution',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'image',
    component: 'JImageUpload',
    componentProps:{
    },
  },
  {
    label: ' 描述',
    field: 'descibles',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
